@extends('layouts.app')

@section('content')
    <div class="container">
        <div class="row">
            <div class="panel panel-default">
                <div class="panel-body">
                    <form class="form-inline" method="get">
                        <div class="form-group">
                            <label for="city">城市</label>
                            <select id="city" name="city" class="form-control">
                                <option value="">全部</option>
                                <option value="长沙" @if($param["city"] == "长沙") selected @endif>长沙</option>
                                <option value="株洲" @if($param["city"] == "株洲") selected @endif>株洲</option>
                                <option value="湘潭" @if($param["city"] == "湘潭") selected @endif>湘潭</option>
                                <option value="衡阳" @if($param["city"] == "衡阳") selected @endif>衡阳</option>
                                <option value="邵阳" @if($param["city"] == "邵阳") selected @endif>邵阳</option>
                                <option value="岳阳" @if($param["city"] == "岳阳") selected @endif>岳阳</option>
                                <option value="常德" @if($param["city"] == "常德") selected @endif>常德</option>
                                <option value="张家界" @if($param["city"] == "张家界") selected @endif>张家界</option>
                                <option value="益阳" @if($param["city"] == "益阳") selected @endif>益阳</option>
                                <option value="郴州" @if($param["city"] == "郴州") selected @endif>郴州</option>
                                <option value="永州" @if($param["city"] == "永州") selected @endif>永州</option>
                                <option value="怀化" @if($param["city"] == "怀化") selected @endif>怀化</option>
                                <option value="娄底" @if($param["city"] == "娄底") selected @endif>娄底</option>
                                <option value="湘西" @if($param["city"] == "湘西") selected @endif>湘西</option>
                                <option value="客服" @if($param["city"] == "客服") selected @endif>客服</option>
                                <option value="远程" @if($param["city"] == "远程") selected @endif>远程</option>
                                <option value="金税" @if($param["city"] == "金税") selected @endif>金税</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="name">姓名</label>
                            <input type="text" class="form-control" name="name" value="{{ $param["name"] }}" id="name" placeholder="姓名">
                        </div>
                        <div class="form-group">
                            <label for="startDate">起始关注时间</label>
                            <div class="input-group date form_date" data-date="{{ $param["startDate"] }}" data-date-format="yyyy-dd-mm" data-link-field="startDate" data-link-format="yyyy-mm-dd">
                                <input class="form-control" size="16" type="text" value="{{ $param["startDate"] }}" readonly>
                                <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                            </div>
                            <input type="hidden" name="startDate"  id="startDate" value="{{ $param["startDate"] }}">
                        </div>
                        <div class="form-group">
                            <label for="endDate">结束关注时间</label>
                            <div class="input-group date form_date" data-date="{{ $param["endDate"] }}" data-date-format="yyyy-dd-mm" data-link-field="endDate" data-link-format="yyyy-mm-dd">
                                <input class="form-control" size="16" type="text" value="{{ $param["endDate"] }}" readonly>
                                <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                                <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                            </div>
                            <input type="hidden" name="endDate" id="endDate" value="{{ $param["endDate"] }}">
                        </div>
                        <button type="submit" class="btn btn-default glyphicon glyphicon-search">搜索</button>
                    </form>
                </div>
            </div>
            <div class="alert alert-info" role="alert">
                关注次数：所有通过二维码关注公众号的次数，包含已经取消关注了的粉丝；取消关注的粉丝再次关注不会再增加关注次数；<br />
                粉丝数量：现有通过二维码关注公众号关注的粉丝，实时统计通过该二维码关注的粉丝，不包含已取消关注的粉丝；
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">二维码
                    <a href="{{ url("qrcode/edit") }}" class="btn btn-primary btn-sm active" role="button">添加</a>
                    <a href="{{ route("qrcode_export", $param) }}" target="_blank" class="btn btn-primary btn-sm active" role="button">下载</a>
                </div>
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th style="width: 75px;">场景值ID</th>
                            <th>名称</th>
                            <th>自动回复</th>
                            <th style="width: 45px;">类型</th>
                            <th style="width: 65px;">二维码</th>
                            <th style="width: 95px;">生成时间</th>
                            <th style="width: 45px;">有效</th>
                            <th style="width: 75px;">关注次数</th>
                            <th style="width: 75px;">粉丝数量</th>
                            <th style="width: 85px;">管理</th>
                        </tr>
                    </thead>
                    <tbody>
                    @foreach($list as $item)
                        <tr>
                            <td>{{ $item->id }}</td>
                            <td>{{ $item->scene_name }}</td>
                            <td>{{ $item->keyword }}</td>
                            <td>{{ $item->typename }}</td>
                            <td>
                                <a href="{{ $item->qrcode_url }}" target="_blank">查看</a>
                            </td>
                            <td>{{ $item->createtime }}</td>
                            <td>{{ $item->expiretime }}</td>
                            <td>{{ $item->scan_fans }} </td>
                            <td><a href="{{ url("qrcode/fanslist", ["scent_id"=>$item->id]) }}"> {{ $item->fans_count }} 次</a></td>
                            <td>
                                <a href="{{ url("qrcode/edit",[$item->id]) }}">修改</a> | <a href="{{ url("qrcode/delete/".$item->id) }}">删除</a>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            </div>
            {!! $list->appends($param)->links() !!}
        </div>
    </div>

@endsection

@section('pageend')
<script type="text/javascript">
    $('.form_date').datetimepicker({
        language:  'zh-CN',
        weekStart: 0,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        minView: 2,
        forceParse: 0
    });
</script>
@endsection